﻿var servs = [
	{ name: '鼠标双击', host: 1 },
    { name: '鼠标单击', host: 2 },
    { name: '单击两边', host: 3 },
    { name: '下拉阅读', host: 4 }
];

var sys = (function () {
    var a = navigator.userAgent;
    return {
        tk: +new Date(),
        ts: (function () {
            var c = new Date,
                d = [];
            d.push(c.getFullYear());
            d.push(c.getMonth() + 1);
            d.push(c.getDate());
            d.push(c.getHours());
            return d.join("")
        })(),
        ie: /msie ([\d.]+)/ig.test(a),
        ie6: !!window.ActiveXObject && !window.XMLHttpRequest,
        mobile: /(iPhone|iPad|iPod|Android|BlackBerry|NokiaN|Symbian|Windows Phone|MQQBrowser)/ig.test(a)
    }
})();
this.body = (document.documentElement && document.documentElement.clientWidth) ? document.documentElement : document.body;
this.$$ = function (a) {
    return document.getElementById(a)
};
String.prototype.trim = function () {
    return this.replace(/(^\s*)|(\s*$)/g, "")
};
uzmh.utils = {
    getQuery: function (b) {
        var a = RegExp("[?&]" + b + "=([^&]*)").exec(window.location.search);
        return a ? decodeURIComponent(a[1].replace(/\+/g, " ")) : ""
    },
    addStyle: function (c) {
        var a = document.getElementsByTagName("head")[0];
        var b = document.createElement("link");
        b.rel = "stylesheet";
        b.type = "text/css";
        b.href = c;
        a.appendChild(b)
    },
    cookie: function (b, k, n) {
        if (typeof k != "undefined") {
            n = n || {};
            if (k === null) {
                k = "";
                n.expires = -1
            }
            var f = "";
            if (n.expires && (typeof n.expires == "number" || n.expires.toUTCString)) {
                var g;
                if (typeof n.expires == "number") {
                    g = new Date();
                    g.setTime(g.getTime() + (n.expires * 24 * 60 * 60 * 1000))
                } else {
                    g = n.expires
                }
                f = "; expires=" + g.toUTCString()
            }
            var m = n.path ? "; path=" + (n.path) : "";
            var h = n.domain ? "; domain=" + (n.domain) : "";
            var a = n.secure ? "; secure" : "";
            document.cookie = [b, "=", encodeURIComponent(k), f, m, h, a].join("")
        } else {
            var d = null;
            if (document.cookie && document.cookie != "") {
                var l = document.cookie.split(";");
                for (var j = 0; j < l.length; j++) {
                    var c = l[j].trim();
                    if (c.substring(0, b.length + 1) == (b + "=")) {
                        d = decodeURIComponent(c.substring(b.length + 1));
                        break
                    }
                }
            }
            return d
        }
    },
    errLog: function (b, d) {
        var a = new Image();
        var c = [];
        if (typeof d != "undefined") {
            for (var f in d) {
                if (!d.hasOwnProperty(f)) {
                    continue
                }
                c.push(f + "=" + escape(d[f]))
            }
        }
        a.src = b + "?" + c.join("&")
    }
};
pVars = {
    page: 1,
    curServ: 0,
    priServ: uzmh.utils.cookie("imgHost") == 3 ? 0 : 2,
    curFile: "",
    adHide: uzmh.utils.cookie("adHide") == "true" || false,
    manga: {
        preLoadNumber: 1,
        loadingTip: "图片努力载入中，请耐心等候。载入完成后会自动缓存下一页的图片。",
        filePath: cInfo.path
    },
    shortcuts: {
        key: {
            prev: "left",
            next: "right",
            prevC: "z",
            nextC: "x",
            ligher: "c"
        },
        tip: function () {
            var a = [];
            a.push('<strong>\u4e0b\u4e00\u9875\uff1a</strong><span class="keyboard key-click"></span>\u53cc\u51fb\u9f20\u6807\u5de6\u952e');
            a.push('<strong>\u4e0a\u4e00\u9875\uff1a</strong><span class="keyboard key-left"></span>\u65b9\u5411\u952e\u5de6\u952e<br /><strong>\u4e0b\u4e00\u9875\uff1a</strong><span class="keyboard key-right"></span>\u65b9\u5411\u952e\u53f3\u952e<br /><strong>\u4e0a\u4e00\u7ae0\uff1a</strong><span class="keyboard key-z"></span>Z\u952e<br /><strong>\u4e0b\u4e00\u7ae0\uff1a</strong><span class="keyboard key-x"></span>X\u952e');
            a.push('<strong>\u5f00\u5173\u706f\uff1a</strong><span class="keyboard key-c"></span>C\u952e');
            a.push('<strong>\u56de\u9876\u90e8\uff1a</strong><span class="keyboard key-v"></span>V\u952e');
            a.push('<strong>\u5168\u3000\u5c4f\uff1a</strong><span class="keyboard key-f11"></span>F11\u952e');
            return "<li>" + a.join("</li><li>") + "</li>"
        }
    },
    header: function () {
        var a = [];
        a.push('<div class="search fr pr">');
        a.push('<input id="txtKey" value="" />');
        a.push('<button id="btnSend">\u641c\u7d22</button>');
        a.push('<div id="sList" class="sList shadow"></div>');
        a.push("</div>");
        a.push('<span class="nav">');
        a.push('<a href="/" title="\u8fd4\u56de\u9996\u9875" class="logo"> </a>');
        a.push('<a href="/list/update.html" class="pr new-update">\u6700\u65b0\u66f4\u65b0<i></i></a>');
        a.push('<a href="/list/all.html">\u6240\u6709\u6f2b\u753b</a>');
        a.push('<a href="/list/wanjie.html">\u5b8c\u7ed3</a>');
        a.push('<a href="/list/lianzai.html">\u8fde\u8f7d</a>');
        a.push('<a href="/list/top.html">排行榜</a>');
        a.push('<a href="/list/japan/">\u65e5\u672c\u6f2b\u753b</a>');
        a.push("</span>");
        a.push('<span class="more pr" id="nav-sec">');
        a.push("<strong>\u66f4\u591a\u7c7b\u522b</strong><i></i>");
        a.push('<div class="content shadow nav-sec"><ul>');
        a.push('<li><a href="/list/japan/">\u65e5\u672c\u6f2b\u753b</a></li>');
        a.push('<li><a href="/list/hongkong/">\u6e2f\u53f0\u6f2b\u753b</a></li>');
        a.push('<li><a href="/list/europe/">\u6b27\u7f8e\u6f2b\u753b</a></li>');
        a.push('<li><a href="/list/china/">\u5927\u9646\u6f2b\u753b</a></li>');
        a.push('<li><a href="/list/other/">其他漫画</a></li>');
        a.push('<li><a href="/list/mhsh/">魔幻神话</a></li>');
        a.push('<li><a href="/list/dzgd/">动作格斗</a></li>');
        a.push('<li><a href="/list/tyjj/">体育竞技</a></li>');
        a.push('<li><a href="/list/snaq/">少女爱情</a></li>');
        a.push('<li><a href="/list/qsgx/">轻松搞笑</a></li>');
        a.push('<li><a href="/list/lzmx/">热血冒险</a></li>');
        a.push('<li><a href="/list/kbgg/">恐怖鬼怪</a></li>');
        a.push('<li><a href="/list/xyta/">悬疑探案</a></li>');
        a.push('<li><a href="/list/khwl/">科幻未来</a></li>');
        a.push('<li><a href="/list/dmbh/">耽美百合</a></li>');
        a.push('<li><a href="/list/lzzc/">励志职场</a></li>');
        a.push('<li><a href="/list/zzls/">战争历史</a></li>');
        a.push('<li><a href="/list/shqq/">生活亲情</a></li>');
        a.push("</ul></div>");
        a.push('</span><span class="more pr" id="history">');
        a.push("<strong>\u6211\u7684\u6d4f\u89c8\u8bb0\u5f55</strong><i></i>");
        a.push('<div class="content shadow" id="hList"><span class="hNone">loading...</span></div>');
        a.push('</span><span class="menu-end"></span>');
        return a.join("")
    },
    lighter: {
        cname: "lighter",
        cvalue: 0,
        config: [
            ["\u5173\u706f", "lighter-close", "#FFF"],
            ["\u5f00\u706f", "lighter-open", "#000"]
        ]
    }
};
uzmh.imgData = {
    getHost: function () {
        try {
            var c = uzmh.utils.cookie("imgHost");
            if (c == null || c == "") {
                var b = Math.floor(Math.random() * pVars.priServ);
                uzmh.utils.cookie("imgHost", b, {
                    expires: 365,
                    path: "/"
                });
                pVars.curServ = b
            } else {
                var a = parseInt(c);
                if (a >= 0 && a < servs.length) {
                    pVars.curServ = a
                }
            }
        } catch (d) { }
    },
    writeList: function () {
        this.getHost();
        var d = [];
        for (var c = 0, a = servs.length; c < a; c++) {
            var b = (c == pVars.curServ) ? ['class="current"', ""] : ["", ""];
            d.push('<li><a href="javascript:void(0)" ' + b[0] + ' onclick="uzmh.setHost(' + c + ')">' + b[1] + servs[c].name + "</a></li>")
        }
        document.write(d.join(""))
    },
    loadIMG: function () {
        $$("imgLoading").innerHTML = "<b></b><span>" + pVars.manga.loadingTip + "</span>";
        $$("imgLoading").style.display = "block";
        pVars.page = Math.min(Math.max(1, uzmh.utils.getQuery("p")), cInfo.files.length);
        pVars.curFile = pVars.manga.filePath + encodeURI(cInfo.files[pVars.page - 1]);
        document.write('<img id="mangaFile" onload="uzmh.imgLoad.success(this)" alt="' + cInfo.bname + " " + cInfo.cname + '" onerror="uzmh.imgLoad.error(this)" class="mangaFile" src="' + pVars.curFile + '" />');
        uzmh.imgLoad.loading();
        $$("page").innerHTML = String(pVars.page);
        $$("pageSelect").selectedIndex = pVars.page - 1
    },
    loadImgMore: function(){
        if (pVars.curServ == 3) {
            document.write('<div align="center" id="mangaMoreBox"><div class="uzmh-vv uzmh-3"><script>uzmhvv.show(5);</script></div><div class="uzmh-vv uzmh-3"><script> uzmhvv.show(5);</script></div><div class="uzmh-vv uzmh-3"><script>uzmhvv.show(5);</script></div></div><div class="loading-box" id="loading" style="display:none;"><img src="/images/show/icon_loading.gif" alt="" /></div>');
        }
    }
};
uzmh.imgLoad = (function () {
    var d = 0;
    var b = [];
    var f;
    b.push(pVars.curServ);

    function a(h) {
        var g = document.createElement("img");
        g.setAttribute("src", h);
        g.style.display = "none";
        $$("imgPreLoad").appendChild(g);
        $$("imgPreLoad").style.display = "none"
    }
    function c() {
        var g = Math.floor(Math.random() * pVars.priServ);
        var h = false;
        for (var i in arguments) {
            if (arguments[i] == g) {
                h = true;
                break
            }
        }
        if (h === true) {
            return c.apply(this, arguments)
        } else {
            b.push(g);
            return g
        }
    }
    return {
        reload: function (g, i) {
            var h = this;
            g.onerror = function () {
                h.error(this)
            };
            g.onload = function () {
                h.success(this)
            };
            g.src = i
        },
        preload: function () {
            for (var h = 1; h <= pVars.manga.preLoadNumber; h++) {
                if ((pVars.page + h - 1) >= cInfo.len) {
                    break
                }
                var g = pVars.manga.filePath + encodeURI(cInfo.files[pVars.page - 1 + h]);
                a(g)
            }
        },
        success: function (g) {
            this.autoresize();
            f && clearTimeout(f);
            $$("imgLoading").style.display = "none";
            g = g.onload = g.onerror = null;
            this.preload()
        },
        autoresize: function () {
            if (uzmh.utils.cookie("autosize") == null) {
                uzmh.utils.cookie("autosize", false, { path: "/" });
            } else {
                var autosize = uzmh.utils.cookie("autosize") == "true";

                if (autosize) {
                    $$("tool-autoresize").className = "fit sel";
                } else {
                    $$("tool-autoresize").className = "fit";
                }

                if (autosize) {
                    if ($$("mangaFile").width > (document.body.offsetWidth - 20)) {
                        $$("mangaFile").width = document.body.offsetWidth - 20;
                    } else if ($$("mangaFile").width < $$("mangaBox").offsetWidth) {
                        $$("mangaFile").width = $$("mangaBox").offsetWidth;
                    }
                }
            }
        },
        loading: function () {
            f = setTimeout(function () {
                if ($$("imgLoading")) {
                    $$("imgLoading").style.display = "none"
                }
            }, 5000)
        },
        error: function (g) {
            this.autoresize();
            if ((sys.ie && g.complete === false) || !sys.ie) {
                var h = this;
                if (d < pVars.priServ) {
                    f && clearTimeout(f);
                    h.loading();
                    if (d == 0) {
                        h.sendErr(pVars.curFile);
                        pVars.curFile += "?_" + sys.tk;
                        h.reload(g, pVars.curFile);
                        d++
                    } else {
                        pVars.curFile = pVars.manga.filePath + encodeURI(cInfo.files[pVars.page - 1]);
                        h.reload(g, pVars.curFile);
                        d++
                    }
                } else {
                    //$$("tbBox").innerHTML = '<span class="nopic">图片载入失败，请 " 按F5键刷新页面 " 或 " 进行报错，管理员会尽快解决 " :(</span>';
                    $$("mangaBox").innerHTML = '<span class="nopic">图片载入失败，请 " 按F5键刷新页面 " 或 " 进行报错，管理员会尽快解决 " :(</span>';
                }
            }
        },
        sendErr: function (g) {
            uzmh.utils.errLog("/support/imgerr.ashx", {
                bid: cInfo.bid,
                cid: cInfo.cid,
                bname: unescape(cInfo.bname),
                cname: unescape(cInfo.cname),
                p: pVars.page,
                url: location.href,
                svr: pVars.curServ,
                img: g
            })
        }
    }
}());
if (sys.ie6 === true) {
    try {
        document.execCommand("BackgroundImageCache", false, true)
    } catch (e) { }
} (function () {
    pVars.lighter.cvalue = uzmh.utils.cookie(pVars.lighter.cname);
    pVars.lighter.cvalue = (pVars.lighter.cvalue === null || pVars.lighter.cvalue == undefined) ? 0 : pVars.lighter.cvalue;
    if (pVars.lighter.cvalue == 1) {
        uzmh.utils.addStyle("/css/black.css")
    }
    if (sys.mobile) {
        uzmh.utils.addStyle("/css/none.css")
    }
}());
var adLoader = function (b) {
    var f = function (h) {
        var g = h.src + "?v=" + sys.ts;
        switch (h.type) {
            case "iframe":
                return "<iframe scrolling='no' allowTransparency='true' frameborder='0' width='" + h.width + "' height='" + h.height + "' src='" + g + "'></iframe>";
            case "htm":
            case "html":
                return h.code;
            case "img":
                return "<a href='" + this.href + "' target='_blank'><img alt='" + h.alt + "' src='" + g + "' border='0' width='" + h.width + "' height='" + h.height + "' /></a>";
            default:
                return ""
        }
    };
    var c = [];
    if (!sys.mobile) {
        for (var d = 0, a = b.length; d < a; d++) {
            c.push(f(b[d]))
        }
    }
    return {
        show: function (j) {
            if (!sys.mobile) {
                var l = b[j];
                var h = l.enable || false;
                var k = $$("uzmh-" + j);
                if (h == false) {
                    if (k) {
                        k.style.display = "none"
                    }
                } else {
                    var g = l.delay || 0;
                    if (g == 0) {
                        document.write(c[j])
                    } else {
                        setTimeout(function () {
                            var i = $$("uzmh-" + j);
                            i.innerHTML = c[j]
                        }, g)
                    }
                }
            }
            else {
                $$("uzmh-" + j).style.display = "none"
            }
        }
    }
};
var isMobile = sys.mobile;


(function () {
    var d = uzmh.utils.cookie("country"),
        b = ["%u9999%u6E2F", "%u65e5%u672c"],
        f = (navigator.language || navigator.userLanguage || navigator.browserLanguage).toLowerCase();

    function a(h, k) {
        var i = /msie/.test(window.navigator.userAgent.toLowerCase());
        var j = /gecko/.test(window.navigator.userAgent.toLowerCase());
        var g = document.createElement("script");
        g.setAttribute("type", "text/javascript");
        g.setAttribute("charset", "utf-8");
        g.setAttribute("src", h);
        document.getElementsByTagName("head")[0].appendChild(g);
        if (i) {
            g.onreadystatechange = function () {
                if (this.readyState == "loaded" || this.readyState == "complete") {
                    k()
                }
            }
        } else {
            if (j) {
                g.onload = function () {
                    k()
                }
            } else {
                k()
            }
        }
    }
    function c(g) {
        if (g != null) {
            if (/(zh-hk|ja)/gi.test(f)) {
                return false
            }
            if (g.indexOf(b[0]) >= 0 || g.indexOf(b[1]) >= 0) {
                return false
            }
        }
        return true
    }
    function e(g) {
        if (g != null) {
            if (g.indexOf('%u4E2D%u56FD') >= 0 && !(g.indexOf('%u9999%u6E2F') >= 0 || g.indexOf('%u53F0%u6E7E') >= 0 || g.indexOf('%u6FB3%u95E8') >= 0 || g.indexOf('%u5E7F%u4E1C') >= 0)) {
                return true;
            }
        }
        return false;
    }
    if (d == null) {
        a("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js", function () {
            var g = remote_ip_info || {
                country: "",
                province: ""
            };
            d = escape(g.country) + "|" + escape(g.province);
            uzmh.utils.cookie("country", d, {
                expires: 3,
                path: "/"
            })
        })
    }
    //if (!c(d) || /(zh-tw|zh-ma|en)/gi.test(f)) { location.href = "/sorry.html" }
    //if (pVars.manga.filePath.indexOf('p2.yzmanga.com') >= 0) {
        //if (!e(d) || Math.random() < 0.8) {
            //pVars.manga.filePath = pVars.manga.filePath.replace('p2.yzmanga.com', 'p20.yzmanga.com');
        //}
    //}
}());

var __is_ff = (navigator.userAgent.indexOf("Firefox") != -1);// Firefox

//事件获取
function getEvent() {
    if (document.all)
        return window.event;
    func = getEvent.caller;
    while (func != null) {
        var arg0 = func.arguments[0];
        if (arg0) {
            if ((arg0.constructor == Event || arg0.constructor == MouseEvent)
					|| (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
                return arg0;
            }
        }
        func = func.caller;
    }
    return null;
}
//鼠标位置
function getMouseLocation() {
    e = getEvent();
    var mouseX = 0;
    if (__is_ff) {
        mouseX = e.layerX - document.getElementById('mangaFile').offsetLeft + document.body.scrollLeft;
    } else {
        mouseX = e.offsetX + document.body.scrollLeft;
    }
    return mouseX;
}

//点击图片跳转
function click_pic(o) {
    var offset_x = getMouseLocation();
    if (offset_x <= o.clientWidth / 2) {
        uzmh.prev();
    } else {
        uzmh.next();
    }
    return false;
}

//鼠标停留在图片上时，样子的转换
function change_style(o) {
    var offset_x = getMouseLocation();
    if (offset_x <= o.clientWidth / 2) {
        if (!o.style.cursor.match("pre")) {
            o.style.cursor = 'url("/images/read/pre.cur"), pointer';// "NW-resize";
        }
    } else if (!o.style.cursor.match("next")) {
        o.style.cursor = 'url("/images/read/next.cur"), pointer';
    }
    return;
}

var uzmhvv = adLoader([{
    type: 'html',
    width: 980,
    height: 86,
    delay: 0,
    code: '<script type="text/javascript">' +
        '/*960*90，创建于2012-11-7*/' +
        'var cpro_id = "u1115993";' +
        '</script>' +
        '<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}, {
    type: 'html',
    width: 980,
    height: 148,
    delay: 0,
    code: '<script type="text/javascript">' +
        '/*960*60，创建于2012-11-7*/' +
        'var cpro_id = "u1116447";' +
        '</script>' +
        '<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}, {
    type: 'html',
    width: 980,
    height: 22,
    delay: 0,
    code: '<script type="text/javascript">' +
        '/*960*90，创建于2012-11-7*/' +
        'var cpro_id = "u1115993";' +
        '</script>' +
        '<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}, {
    type: 'html',
    width: 980,
    height: 22,
    delay: 0,
    code: '<script type="text/javascript">var cpro_id = "u1238154";</script><script src="http://cpro.baidustatic.com/cpro/ui/f.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}, {
    type: 'html',
    width: 980,
    height: 22,
    delay: 0,
    code: '<script type="text/javascript">var cpro_id = "u1238162";</script><script src="http://cpro.baidustatic.com/cpro/ui/f.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}, {
    type: 'html',
    width: 980,
    height: 22,
    delay: 0,
    code: '<script type="text/javascript">var cpro_id = "u1267118";</script><script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>',
    enable: !pVars.adHide
}]);